﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using V_League.Public;

namespace V_League.DataAccess
{
    public class SAN_DataAccess
    {
        clsConnect cls;

        public DataTable ListSAN()
        {
            cls = new clsConnect();
            DataTable dt = cls.LoadData("listSAN");
            cls.Disconnect();
            return dt;
        }

        public SANVD_Public GetInfoSAN(String Ma_San)
        {
            cls = new clsConnect();
            SANVD_Public SAN = new SANVD_Public();
            int nParameter = 1;

            String[] name = new String[nParameter];
            Object[] value = new Object[nParameter];

            name[0] = "@MaSan";
            value[0] = Ma_San;

            SqlDataReader reader = cls.ExecuteDataReader("GetInfoSAN", name, value, nParameter);
            while (reader.Read())
            {
                SAN.MaSan = Ma_San;
                SAN.TenSan = reader["TenSan"].ToString();
                SAN.SucChua = int.Parse(reader["SucChua"].ToString());
                SAN.DD_San = reader["DD_San"].ToString();
            }

            cls.Disconnect();
            return SAN;
        }
    }
}
